package com.dnake.libface;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class ThreadPool {
    private static ExecutorService mCacheThreadPool;
    private static ThreadPool instance;

    public ThreadPool() {
        mCacheThreadPool = Executors.newCachedThreadPool();
    }

    public static ThreadPool getInstance() {
        if(instance == null){
            synchronized (ThreadPool.class){
                if(instance == null){
                    instance = new ThreadPool();
                }
            }
        }
        return instance;
    }

    public void execute(Runnable runnable) {
        mCacheThreadPool.execute(runnable);
    }
}
